home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-30 | 2.0 KB | 75 lines | [TEXT/CWIE] |
- // LControlEnablingEditField
- // enables and disables the attached LControl when the field is empty
- // ©1995 A.D. Software, all rights reserved
- // freely licensed for any use
- // contact dent@highway1.com.au or http://www.highway1.com.au/adsoftware/
-
- /*
- INSTRUCTIONS
- in FinishCreateSelf()
- 1)
- create the control with a cast like:
- mFindField = (LControlEnablingEditField *)FindPaneByID('Edit');
-
- instead of the normal
- mFindField = (LEditField *)FindPaneByID('Edit');
-
- 2)
- tell the field which control it enables, eg:
- mFindField->enablesControl(mFindButton);
-
- 3)
- if you want to reverse the sense of when the control should be enabled/disabled
- mFindField->disableWhenEmpty()
-
- */
-
- #pragma once
-
- #include <LEditField.h>
-
- class LControl;
-
- class LControlEnablingEditField : public LEditField {
- public:
- enum { class_ID = 'ened' };
- static LControlEnablingEditField* CreateControlEnablingEditFieldStream(LStream *inStream);
-
- LControlEnablingEditField();
- LControlEnablingEditField(
- const LControlEnablingEditField &inOriginal);
- LControlEnablingEditField(
- const SPaneInfo &inPaneInfo,
- Str255 inString,
- ResIDT inTextTraitsID,
- Int16 inMaxChars,
- Boolean inHasBox,
- Boolean inHasWordWrap,
- KeyFilterFunc inKeyFilter,
- LCommander *inSuper);
- LControlEnablingEditField(
- const SPaneInfo &inPaneInfo,
- Str255 inString,
- ResIDT inTextTraitsID,
- Int16 inMaxChars,
- Uint8 inAttributes,
- KeyFilterFunc inKeyFilter,
- LCommander *inSuper);
- LControlEnablingEditField(
- LStream *inStream);
- virtual ~LControlEnablingEditField() {};
-
-
- virtual void UserChangedText(); // the main reason for our existence!
-
- LControl* enablesControl();
- void enablesControl(LControl*);
-
- Boolean enablesWhenEmpty();
- void enableWhenEmpty();
- void disableWhenEmpty(); // default case
-
- private:
- LControl* mEnablingTarget;
- Boolean mEnableWhenEmpty;
- };